package action;

import java.util.List;

import com.opensymphony.xwork2.ActionContext;
import model.ProjectInfo;
import model.User;
import action.base.BaseAction;

public class SelfGetProjectInfo extends BaseAction {
	private User user;
	private ProjectInfo projectInfo;
	public ProjectInfo getProjectInfo() {
		return projectInfo;
	}
	public void setProjectInfo(ProjectInfo projectInfo) {
		this.projectInfo = projectInfo;
	}
	public String execute() throws Exception{
		ActionContext ctx = ActionContext.getContext();
		user = (User)ctx.getSession().get("USER");
		List<ProjectInfo> ei = mgp.getProjectByUser(user);
		if(ei.size()>0){
			ProjectInfo e = (ProjectInfo)ei.get(0);
			setProjectInfo(e);
			ctx.getSession().put("P", e);
			return "input";
		}else{
			return "input";
		}
	}
}
